package com.xjl.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xjl.demo.Admin;
import com.xjl.service.AdminService;
import com.xjl.service.impl.AdminServiceImpl;

/**
 * 处理用户查询所有管理员
 * @author JianLin_Xu
 *
 */
@WebServlet("/selectall.do")
public class SelectAllAdminServlet extends HttpServlet {
	
	AdminService as = new AdminServiceImpl();
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		//设置请求编码格式
		req.setCharacterEncoding("utf-8");
		//设置响应编码格式
		resp.setContentType("text/html;utf-8");
		List<Admin> alladmin = as.SelectAllAdmin();
		req.setAttribute("alladmin",alladmin );
		req.getRequestDispatcher("admin/selectall.jsp").forward(req, resp);
	}
	
}
